package com.lej.dataservice.club.bean.nim.redPacket

import com.jeremyliao.liveeventbus.core.LiveEvent

data class RedPacketEvent(
    val msgType: Int,//事件类型
    var redPacketId: String = "",
    var redPacketStatus: Int = RedPacketMsgInfo.SEND_ING,
    var location: IntArray? = null
) : LiveEvent {
    companion object {
        const val SEND_RED_PACK = 1//发送红包
        const val SEE_RED_PACKET_DETAIL = 2//查看红包
        const val DRAW_RED_PACKET = 3//领取红包
        const val RED_PACKET_OVERDUE = 4//红包失效

        const val SHOW_PACKET_OVERDUE = 5//显示红包弹窗
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as RedPacketEvent

        if (msgType != other.msgType) return false
        if (redPacketId != other.redPacketId) return false
        if (redPacketStatus != other.redPacketStatus) return false
        if (location != null) {
            if (other.location == null) return false
            if (!location.contentEquals(other.location)) return false
        } else if (other.location != null) return false

        return true
    }

    override fun hashCode(): Int {
        var result = msgType
        result = 31 * result + redPacketId.hashCode()
        result = 31 * result + redPacketStatus
        result = 31 * result + (location?.contentHashCode() ?: 0)
        return result
    }
}